package com.zhiyou100.javawebreview.tomcat;

import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @packageName: Demo05_MyTomcat
 * @className: com.zhiyou100.javawebreview.tomcat
 * @Description: TODO 开启服务器
 * @author: yang
 * @date: 7/15/20
 */
public class Demo05_MyTomcat {
    public static void main(String[] args)  throws Exception{
        ServerSocket ss = new ServerSocket(10086);
        Socket socket = ss.accept();
        InputStream in = socket.getInputStream();
        byte[] arr = new byte[1024 * 10];
        int n = in.read(arr);
        System.out.println(new String(arr,0,n));

        // 浏览器 地址栏输入请求
        // http://localhost:10086/?name=tom&age=11

// 获取的请求数据
//GET /?name=tom&age=11 HTTP/1.1
//Host: localhost:10086
//Connection: keep-alive
//Upgrade-Insecure-Requests: 1
//User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
//Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
//Sec-Fetch-Site: none
//Sec-Fetch-Mode: navigate
//Sec-Fetch-User: ?1
//Sec-Fetch-Dest: document
//Accept-Encoding: gzip, deflate, br
//Accept-Language: zh-CN,zh;q=0.9,en;q=0.8
//Cookie: Idea-b9fea2c2=ae7b827a-3998-40d2-a4fe-1e7647023658; s_fid=47827F7F1CC4A6EA-14B7B4A381AD9B5D; s_vnum_n2_us=4%7C1


    }
}

/*
GET /?name=tom&age=11 HTTP/1.1
Host: localhost:10086
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*//*;q=0.8,application/signed-exchange;v=b3;q=0.9
        Sec-Fetch-Site: none
        Sec-Fetch-Mode: navigate
        Sec-Fetch-User: ?1
        Sec-Fetch-Dest: document
        Accept-Encoding: gzip, deflate, br
        Accept-Language: zh-CN,zh;q=0.9,en;q=0.8
        Cookie: Idea-b9fea2c2=ae7b827a-3998-40d2-a4fe-1e7647023658; s_fid=47827F7F1CC4A6EA-14B7B4A381AD9B5D; s_vnum_n2_us=4%7C1



        */
